home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hacker's Secrets 4
/
Hacker's Secrets 4.iso
/
internet
/
sendfake.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-04-26
|
3KB
|
143 lines
/* *************************************************************************
SENDFAKE.C
Author: asm@quantum.syspac.com
This program reads a file with the body of your forged mail and sends
it to a given address. You must edit a file and put the contents of
your mail in first.
To compile: gcc -o sendfake sendfake.c (don't worry about warning errors)
usage: sendfake (You must have the text of the fake mail in a file!)
*********************************************************************** */
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#define MAXLEN 256
int s;
int call_socket(char *hostname)
{
struct sockaddr_in sa;
struct hostent *hp;
int a, s;
if ((hp=gethostbyname(hostname))==NULL) return(-1);
bzero(&sa, sizeof(sa));
bcopy(hp->h_addr, (char *)&sa.sin_addr, hp->h_length);
sa.sin_family = hp->h_addrtype;
sa.sin_port = htons((u_short)25);
if((s=socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0)
return(-1);
if(connect(s, &sa, sizeof(sa)) < 0) {
close(s);
return(-1);
}
return(s);
}
int readln(char *buf)
{
int to=0;
char c;
do {
if(read(s, &c, 1)<1)
return(0);
if((c >= ' ') || (c <= 126))
if(to<MAXLEN-1)
buf[to++] = c;
} while (c != '\n');
buf[to] = '\0';
return(1);
}
void writeln(char *buf)
{
write(s, buf, strlen(buf));
write(s, "\n",1);
}
void input(char *msg,char *pt)
{
printf("%s: ",msg);
gets(pt);
}
int main(void)
{
char hostn[20];
char from[40];
char to[40];
char name[40];
char subject[60];
char passw[20];
char str[MAXLEN];
char buf[MAXLEN];
FILE *fp;
printf("\n");
printf("Welcome to sendfake! The BEST fake/anon mailer there is!\n");
printf("12-27-1995, asm@quantum.syspac.com\n");
printf("\n");
input("Host to fake mail from",hostn);
if((s=call_socket(hostn)) <0) {
perror("Connection error");
exit(1);
}
readln(buf);
gethostname(hostn,20);
sprintf(str, "HELO %s", hostn);
writeln(str);
readln(buf);
input("Fake email address fakemail is FROM",from);
sprintf(str, "MAIL FROM: <%s>",from);
writeln(str);
readln(buf);
do {
input("Send fake mail TO",to);
sprintf(str, "RCPT TO: <%s>",to);
writeln(str);
readln(buf);
*(buf+3) = 0;
if(atoi(buf) == 250) break; else printf("%s",buf+4);
} while(1);
input("Name of lamer getting the fake mail",name);
input("Subject of fake mail",subject);
writeln("DATA");
sprintf(str,"To: %s <%s>",name,to);
writeln(str);
if(strlen(subject)) {
sprintf(str, "Subject: %s", subject);
writeln(str);
}
do {
input("File to read and include in fake mail",str);
if(!strlen(str)) {
close(s);
exit(1);
}
if((fp = fopen(str,"rt")) == NULL) printf("Could not find file %s\n",
str);
else break;
} while(1);
while(fgets(str,MAXLEN,fp)) write(s, str, strlen(str));
writeln("\n.\n");
readln(buf);
writeln("QUIT\n");
printf("Sent!!!\n");
close(s);
}